<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>

		<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
	</head>
	<body>
		<div id="app">
			<time-comp></time-comp>
		</div>
		
		<script>
			var img = document.createElement("img");
			img.setAttribute("src","loading.gif")
			
			var app = Vue.createApp({
				data() {
					return {
						"message": "Hello Vue!"
					}
				}
			});
			app.component("time-comp",{
				data(){
					return {
						currentTime:'?'
					}
				},
				beforeCreate(){
					document.body.append(img)
				},
				created(){
					setTimeout(()=>{
						document.body.remove(img);
						this.currentTime = new Date().toLocaleTimeString()
					},5000)
				},
				template:"<div>当前时间:{{currentTime}}</div>"
			})
			
			var vm = app.mount("#app")
		</script>



	</body>
</html>